<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/includes/head.jsp"%>
<title>FeedDreamwork - 修改 Feed</title>
</head>
<body>
<%@ include file="/includes/top.jsp"%>
<div id="menu">
<ul>
	<li><a href="/">主页</a></li>
	<li class="active"><a href="/settings/listfeed.jsp">我的 Feed</a></li>
	<li><a href="/settings/addfeed.jsp">添加 Feed</a></li>
	<li><a href="/admin/admin.jsp">管理员工具</a></li>
	<%@ include file="/includes/userinfo.jsp"%>
</ul>
</div>
<div id="page">
<%
	String feedId = request.getParameter("feedid");
	FeedInfoRepository feedInfoRepo = new FeedInfoRepository();
	try {
		FeedInfo feedInfo = feedInfoRepo.getFeedInfo(feedId);
		if (feedInfo == null)
			return;
		if (!feedInfo.hasModifyPermission(userService))
			return;
		String processors = "";
		for (String command : feedInfo.getProcessors())
			processors += command + "\n";
%>
<form action="/settings/editfeed" method="post">
<p><label>Feed 地址：</label><%=ApplicationProperty.HOST_NAME%>/feed/<%=feedInfo.getFeedId()%><input
	type="hidden" name="feedid" value="<%=feedInfo.getFeedId()%>" /></p>
<p><label for="frequency">缓存时间：</label><input type="text"
	id="frequency" name="frequency" value="<%=feedInfo.getFrequency()%>" />
秒</p>
<p><label for="targettype">Feed 格式：</label> <select id="targettype"
	name="targettype">
	<%
		if (feedInfo.getTargetType().equals("RSS 2.0")) {
	%>
	<option value="RSS 2.0" selected="selected">RSS 2.0</option>
	<option value="Atom 1.0">Atom 1.0</option>
	<%
		} else {
	%>
	<option value="RSS 2.0">RSS 2.0</option>
	<option value="Atom 1.0" selected="selected">Atom 1.0</option>
	<%
		}
	%>
</select></p>
<p><label for="processors">处理指令：</label></p>
<p><textarea name="processors" id="processors" cols="70" rows="10"><c:out
	value="<%=processors%>" escapeXml="true" /></textarea></p>
<p><input type="submit" value="提交" /></p>
</form>
<%
	} finally {
		feedInfoRepo.close();
	}
%>
</div>
<%@ include file="/includes/footer.jsp"%>
</body>
</html>
